#include <iostream>

using namespace std;

const int N = 1e6 + 10;

typedef long long ll;

int a[N], c[N];
ll b;
int la, lc;
ll t;

void div(int c[], int a[], int b)
{
	for(int i = la - 1; i >= 0; i--)
	{
		t = t * 10 + a[i];
		c[i] = t / b;
		t = t % b;
	}
	while(lc > 1 && c[lc - 1] == 0)
	    lc--;
}
int main()
{
	string x;
	cin >> x;
	cin >> b;
	la = x.size(), lc = la;
	for(int i = 0; i < la; i++)
	{
		a[la - i - 1] = x[i] -'0';
	}
	div(c, a, b);
	
	for(int i = lc - 1; i >= 0; i--)
	    cout << c[i];
	return 0;
}
